package gaff.action;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
public class DataController {
    @RequestMapping(value = "/passDate", method = RequestMethod.POST)
    public Date passDate(@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date birthday) {
        return birthday;
    }

    @RequestMapping(value = "/passDateTime", method = RequestMethod.POST)
    public Date passDateTime(@RequestParam(required = false) Date birthday) {
        return birthday;
    }

    @RequestMapping(value = "/passStringArray", method = RequestMethod.POST)
    public String[] passStringArray(@RequestParam(value = "ids[]", required = false) String[] ids) {
        return ids;
    }

    @RequestMapping(value = "/passIntegerArray", method = RequestMethod.POST)
    public Integer[] passIntegerArray(@RequestParam(value = "ids[]", required = false) Integer[] ids) {
        return ids;
    }

    @RequestMapping(value = "/passList", method = RequestMethod.POST)
    public List<User> passList(@RequestBody List<User> users) {
        return users;
    }
}